package cn.ht.jywrwater.module.ht.dal.mysql.waterpipenet;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.waterpipenet.WaterPipenetDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.waterpipenet.vo.*;

/**
 * 管网 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterPipenetMapper extends BaseMapperX<WaterPipenetDO> {

    default PageResult<WaterPipenetDO> selectPage(WaterPipenetPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterPipenetDO>()
                .likeIfPresent(WaterPipenetDO::getStationName, reqVO.getStationName())
                .eqIfPresent(WaterPipenetDO::getPosition, reqVO.getPosition())
                .eqIfPresent(WaterPipenetDO::getPipenetPosition, reqVO.getPipenetPosition())
                .betweenIfPresent(WaterPipenetDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterPipenetDO::getId));
    }

    default List<WaterPipenetDO> selectList(WaterPipenetExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterPipenetDO>()
                .likeIfPresent(WaterPipenetDO::getStationName, reqVO.getStationName())
                .eqIfPresent(WaterPipenetDO::getPosition, reqVO.getPosition())
                .eqIfPresent(WaterPipenetDO::getPipenetPosition, reqVO.getPipenetPosition())
                .betweenIfPresent(WaterPipenetDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterPipenetDO::getId));
    }

}
